package com.hjh.redisdemo.service.Impl;

import com.hjh.redisdemo.entity.UserBean;
import com.hjh.redisdemo.repository.UserBeanRepository;
import com.hjh.redisdemo.service.IUserService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
//配置缓存
@CacheConfig(cacheNames = "IUserService")
public class IUserServiceImpl implements IUserService {

    @Resource
    private UserBeanRepository userBeanRepository;

    //配置缓存
    @Cacheable(value = "getSysUserListBiz",keyGenerator = "keyGenerator")
    @Override
    public UserBean getUser(String usrName) {
        return userBeanRepository.findUserByUsrName(usrName);
    }
//
//    @Override
//    public User login(String usrName, String userPassword) {
//        return userRepository.findUserByUsrNameAndUsrPassword(usrName,userPassword);
//    }
//
//    @Override
//    public User addUser(User user) {
//        return null;
//    }
//
//    @Override
//    public void deleteUser(Long usrId) {
//
//    }
//
//    @Override
//    public User updateUser(User user) {
//        return null;
//    }
//
//    @Override
//    public User getUser(Long usrId) {
//        return userRepository.getOne(usrId);
//    }
//
//    @Override
//    public List<User> findAllUsers() {
//        return userRepository.findAll();
//    }
}
